<?php
    if (empty($form->resubmit)) {
        $form->resubmit = 0;
    }
    if (empty($form->maxbytes)) {
        $form->maxbytes = $CFG->aca_maxbytes;
    }
    if (empty($form->emailteachers)) {
        $form->emailteachers = '';
    }
    if (empty($form->sourcefile)) {
        $form->sourcefile = '';
    }
    if (isset($form->gradetype) && $form->gradetype=='') {
        $form->gradetype = 1;
    }
    if (empty($form->grademax)) {
        $form->grademax = 0;
    }
    if (empty($form->grademin)) {
        $form->grademin = 0;
    }
    if (empty($form->graderandval)) {
        $form->graderandval = 1;
    }
?>

<table align="center" cellpadding="5" cellspacing="0">

<tr valign="top">
    <td align="right"><b><?php print_string("maximumsize", "aca") ?>:</b></td>
    <td>
    <?php
        $choices = get_max_upload_sizes($CFG->maxbytes, $this->course->maxbytes);
        choose_from_menu ($choices, "maxbytes", $form->maxbytes, "");
    ?>
  </td>
</tr>

<tr>
    <td align="right"><b><?php print_string("allowresubmit", "aca") ?>:</b></td>
    <td>
    <?php 
        $options[0] = get_string("no"); $options[1] = get_string("yes");
        choose_from_menu($options, "resubmit", $form->resubmit, "");
        helpbutton("resubmit", get_string("allowresubmit", "aca"), "aca");
    ?>
    </td>
</tr>

<tr>
    <td align="right"><b><?php print_string("emailteachers", "aca") ?>:</b></td>
    <td>
    <?php 
        $options[0] = get_string("no"); $options[1] = get_string("yes");
        choose_from_menu($options, "emailteachers", $form->emailteachers, "");
        helpbutton("emailteachers", get_string("emailteachers", "aca"), "aca");
    ?>
    </td>
</tr>

<tr>
    <td colspan="2" align="center"><?php $this->get_source_files($form) ?></td>
</tr>

<tr>
    <td align="right" valign="bottom"><b><?php print_string("teacherfile", "aca") ?>:</b></td>
    <td>
    <?php 
        $struploadafile = get_string("uploadafile");
        $strmaxsize = get_string("maxsize", "", display_size($form->maxbytes));
        echo "<p>$struploadafile ($strmaxsize)</p>";
        require_once($CFG->libdir.'/uploadlib.php');
        upload_print_form_fragment(1,array('sourcefile'),false,null,0,$form->maxbytes,false);
        helpbutton("teacherfile", get_string("teacherfile", "aca"), "aca");
    ?>
    </td>
</tr>

<tr>
    <td align="right" valign="bottom"><b><?php print_string("gradetype", "aca") ?>:</b></td>
    <td>
    <?php 
        for ($i=0;$i<=3;$i++) $options[$i] = get_string('gradetype'.$i,'aca');
        choose_from_menu($options, "gradetype", $form->gradetype, "");
        helpbutton("grading", get_string("gradetype", "aca"), "aca");
    ?>
    </td>
</tr>

<tr>
    <td align="right" valign="middle"><b><?php print_string("gradeoptions", "aca") ?>:</b></td>
    <td>
    <?php 
        unset($options);
        $options[0]=get_string('grademmoptweight','aca');
        $options[1]=get_string('grademmoptrand','aca');
        
        print_string('gradeovermax','aca'); echo ':';
        choose_from_menu($options, "grademax", $form->grademax, "");
        echo '<br />';
        
        unset($options[1]);
        print_string('gradeundermax','aca'); echo ':';
        choose_from_menu($options, "grademin", $form->grademin, "");
        echo '<br />';
        
        print_string('graderand','aca');
    ?>
        <input type="text" name="graderandval" size=3 value="<?php p($form->graderandval) ?>">
    </td>
</tr>

</table>

<center>
<br />
<input type="submit" value="<?php print_string("continue") ?>" />
</center>
